<?php

namespace App\Http\Middleware;

use App\Traits\ApiResponseTrait;
use Closure;

class AuthToken
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $token = $request->input('access_token');
        if(empty($token)) {
            return ApiResponseTrait::error('非法请求');
        }
        return $next($request);
    }
}
